﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;

using System.Linq;

using ProjectBase.Core;

using $prjsn$.Common.Business.Services;
using $prjsn$.Common.Data.Services;
using $prjsn$.Entity;
using $prjsn$.Entity.Services;

namespace $safeprojectname$.Services
{
    public class ContentTypeFacade
        : CodeListFacade<ContentType, ContentTypeFilter, IContentTypeDao>, IContentTypeFacade
    {
        #region IBaseFacade<T> override - FACTORY METHOD
        public override ContentType CreateNew(string code, string name, bool isVisible)
        {
            var entity = base.CreateNew(code, name, isVisible);
            entity.Suffix = string.Empty;
            return entity;
        }
        #endregion IBaseFacade<T> override - FACTORY METHOD

        #region IContentTypeFacade Members
        public virtual ContentType GetBySuffix(string suffix)
        {
            return GetAll().Where(e => e.Suffix.EndsWith(suffix)).FirstOrDefault();
        }
        #endregion
    }
}